package goinput

// Slice of pressed key names.
type PressedKeys []string

// Remove all matches of key.Code[pairNum] and data.Bytes() from pressedKeys.
func (pressedKeys *PressedKeys) Update(keys Keys, data Data, pairNum int) (updatedPressedKeys *PressedKeys) {
	updatedPressedKeys = &PressedKeys{}

	for _, name := range *pressedKeys {
		if keys[name].Equal(data.Bytes(), pairNum) {
			*updatedPressedKeys = append(*updatedPressedKeys, name)
		}
	}

	*pressedKeys = *updatedPressedKeys

	return
}
